﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.SqlClient;

namespace ERPStore.QuoteCart.Repositories
{
    public class QuoteCartDbContext : DbContext
    {
		public QuoteCartDbContext()
		{

		}

		public QuoteCartDbContext(string connectionString)
			: base(connectionString)
		{
			var csBuilder = new SqlConnectionStringBuilder(this.Database.Connection.ConnectionString);
			csBuilder.ApplicationName = this.GetType().Assembly.FullName + "," + System.Environment.MachineName;
			this.Database.Connection.ConnectionString = csBuilder.ConnectionString;
		}


        public DbSet<Datas.QuoteCart> QuoteCart { get; set; }
        public DbSet<Datas.QuoteCartItem> QuoteCartItem { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new Mapping.QuoteCartMap());
            modelBuilder.Configurations.Add(new Mapping.QuoteCartItemMap());
        }
    }
}
